package src.test;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class ThreadClient extends Thread 
{	
	public void run()
	{
		Socket comm = null;
		InputStream is = null;
		 
		try
		{
		 	comm = new Socket("localhost", 8070);
		 
			comm.getOutputStream().write("Bonjour je suis le client1\n\n".getBytes());
			is = comm.getInputStream();
		 	int c=0;
			while((c = is.read()) != -1)
			{
		    	System.out.print(" ");
		    	System.out.write(c);
		    }
		    System.out.println("kljlj");
		}
		catch(Exception e)
		{
			System.err.println("Exception " + e.toString());
		}
		finally
		{
			if (is!=null)
				try 
				{
					is.close();
				} catch (IOException e) {e.printStackTrace();}
			if (comm!=null)
				try 
				{
					comm.close();
				} catch (IOException e) {e.printStackTrace();}
		}
	}
}
